home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ADA Programming Guide
/
ADA Programming Guide.iso
/
adatutor
/
adawkbk
/
sol2-4.ada
< prev
next >
Wrap
Text File
|
1996-01-30
|
613b
|
29 lines
-- Problem 2.4
-- by Rick Conn
with Text_IO;
procedure Main is
type String_Rec is record
S : STRING(1..80);
L : NATURAL; -- last index
end record;
SRA : array (1..5) of String_Rec;
begin -- Main
Text_IO.Put_Line ("Enter 5 strings:");
for I in 1 .. 5 loop
Text_IO.Put ("String " & NATURAL'IMAGE(I) & ": ");
Text_IO.Get_Line (SRA(I).S, SRA(I).L);
end loop;
for I in 1 .. 5 loop
Text_IO.Put ("Output String " & NATURAL'IMAGE(I) & ": ");
Text_IO.Put_Line (SRA(I).S (1 .. SRA(I).L));
-- output a slice of the string
end loop;
end Main;